package com.yfp.operation.controller;

import com.yfp.common.core.domain.R;
import com.yfp.common.core.web.controller.BaseController;
import com.yfp.common.core.web.page.TableDataInfo;
import com.yfp.operation.domain.dto.WarnParameterDTO;
import com.yfp.operation.domain.vo.MachineErrorVO;
import com.yfp.operation.service.MachineExpireWarnService;
import com.yfp.operation.service.MachineInventoryWarnService;
import com.yfp.operation.service.MachineNetWarnService;
import com.yfp.operation.service.MachineTempWarnService;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/warn")
@Tag(name = "报警管理")
public class MachineWarnController extends BaseController {

    @Resource
    private MachineNetWarnService machineNetWarnService;
    @Resource
    private MachineTempWarnService machineTempWarnService;
    @Resource
    private MachineExpireWarnService machineExpireWarnService;
    @Resource
    private MachineInventoryWarnService machineInventoryWarnService;


//    @GetMapping("/getExpireWarn")
//    public R getMachineExpireWarn(WarnParameter warnParameter) {
//        List<MachineError> machineErrorList = machineExpireWarnService.getMachineExpireWarn(warnParameter);
//        return R.ok(machineErrorList);
//    }
//
//
//    @GetMapping("/getInventoryWarn")
//    public R getMachineInventoryWarn(WarnParameter warnParameter) {
//        List<MachineError> machineErrorList = machineInventoryWarnService.getMachineInventoryWarn(warnParameter);
//        return R.ok(machineErrorList);
//    }

    @Operation(summary = "报警管理", description = "报警管理页面使用")
    @GetMapping("/list")
    public R<TableDataInfo<List<MachineErrorVO>>> getMachineWarn(WarnParameterDTO warnParameterDTO) {
        startPage();
        List<MachineErrorVO> machineErrorVOList = machineNetWarnService.getMachineWarn(warnParameterDTO);
        TableDataInfo dataTable = getDataTable(machineErrorVOList);
        return R.ok(dataTable);
    }


//    @GetMapping("/getTempWarn")
//    public R getMachineTempWarn(WarnParameter warnParameter) {
//        List<MachineError> machineErrorList = machineTempWarnService.getMachineTempWarn(warnParameter);
//        return R.ok(machineErrorList);
//    }



}
